﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LinqToLfsWorld.Utility
{
	/// <summary>
	/// Converts circuit 3-digit identifiers into its full name for display.
	/// </summary>
	public sealed class CircuitNameFactory
	{
		private static Dictionary<string, string> _Lookup = null;

		static CircuitNameFactory() 
		{
			InitialiseLookup();
		}

		private static void InitialiseLookup()
		{
			_Lookup = new Dictionary<string, string>();

			// Blackwood GP
			_Lookup.Add("000", "Blackwood GP");
			_Lookup.Add("001", "Blackwood GP Reverse");
			_Lookup.Add("010", "Blackwood Rallycross");
			_Lookup.Add("011", "Blackwood Rallycross Reverse");
			_Lookup.Add("020", "Blackwood Carpark");

			// South City
			_Lookup.Add("100", "South City Classic");
			_Lookup.Add("101", "South City Classic Reverse");
			_Lookup.Add("110", "South City Sprint 1");
			_Lookup.Add("111", "South City Sprint 1 Reverse");
			_Lookup.Add("120", "South City Sprint 2");
			_Lookup.Add("121", "South City Sprint 2 Reverse");
			_Lookup.Add("130", "South City Long");
			_Lookup.Add("131", "South City Long Reverse");
			_Lookup.Add("140", "South City Town Course");
			_Lookup.Add("141", "South City Town Course Reverse");
			_Lookup.Add("150", "South City Chicane Route");
			_Lookup.Add("151", "South City Chicane Route Reverse");

			// Fern Bay
			_Lookup.Add("200", "Fern Bay Club");
			_Lookup.Add("201", "Fern Bay Club Reverse");
			_Lookup.Add("210", "Fern Bay Green");
			_Lookup.Add("211", "Fern Bay Green Reverse");
			_Lookup.Add("220", "Fern Bay Gold");
			_Lookup.Add("221", "Fern Bay Gold Reverse");
			_Lookup.Add("230", "Fern Bay Black");
			_Lookup.Add("231", "Fern Bay Black Reverse");
			_Lookup.Add("240", "Fern Bay Rallycross");
			_Lookup.Add("241", "Fern Bay Rallycross Reverse");
			_Lookup.Add("250", "Fern Bay Rallycross Green");
			_Lookup.Add("251", "Fern Bay Rallycross Green Reverse");

			// Autocross
			_Lookup.Add("300", "Autocross");
			_Lookup.Add("310", "Skid Pad");
			_Lookup.Add("320", "Drag Strip");
			_Lookup.Add("330", "8 Lane Drag");

			// Kyoto Ring
			_Lookup.Add("400", "Kyoto Oval");
			_Lookup.Add("401", "Kyoto Oval Reverse");
			_Lookup.Add("410", "Kyoto National");
			_Lookup.Add("411", "Kyoto National Reverse");
			_Lookup.Add("420", "Kyoto GP Long");
			_Lookup.Add("421", "Kyoto GP Long Reverse");

			// Westhill
			_Lookup.Add("500", "Westhill International");
			_Lookup.Add("501", "Westhill International Reverse");

			// Aston
			_Lookup.Add("600", "Aston Cadet");
			_Lookup.Add("601", "Aston Cadet Reverse");
			_Lookup.Add("610", "Aston Club");
			_Lookup.Add("611", "Aston Club Reverse");
			_Lookup.Add("620", "Aston National");
			_Lookup.Add("621", "Aston National Reverse");
			_Lookup.Add("630", "Aston Historic");
			_Lookup.Add("631", "Aston Historic Reverse");
			_Lookup.Add("640", "Aston Grand Prix");
			_Lookup.Add("641", "Aston Grand Prix Reverse");
			_Lookup.Add("650", "Aston Grand Touring");
			_Lookup.Add("651", "Aston Grand Touring Reverse");
			_Lookup.Add("660", "Aston North");
			_Lookup.Add("661", "Aston North Reverse");
		}


		/// <summary>
		/// Gets the full circuit name from its identifier.
		/// </summary>
		/// <param name="ident">The ident.</param>
		public static string GetNameFromIdent(string ident)
		{
			if (_Lookup.ContainsKey(ident))
				return _Lookup[ident];
			else
				return ident;
		}

	}
}
